<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="Access-Control-Allow-Origin" content="*">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<title>标签对应的笔记列表</title>
		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<link rel="stylesheet" type="text/css" href="css/reset.css" />
		<style>
		.note-list,
			.folder-list {
				padding: 10px 0 10px;
				border-bottom: dashed 1px #CACACD;
				flex-flow: column;
			}
			
			.title-weight {
				font-size: 16px;
				font-weight: bold;
				margin-bottom: 10px;
			}
			/*文件夹图标
			@font-face {
				font-family: 'iconfont';
				/* project id 1571015 */
			
			src: url('//at.alicdn.com/t/font_1571015_wp63s5c36xe.eot');
			src: url('//at.alicdn.com/t/font_1571015_wp63s5c36xe.eot?#iefix') format('embedded-opentype'),
			url('//at.alicdn.com/t/font_1571015_wp63s5c36xe.woff2') format('woff2'),
			url('//at.alicdn.com/t/font_1571015_wp63s5c36xe.woff') format('woff'),
			url('//at.alicdn.com/t/font_1571015_wp63s5c36xe.ttf') format('truetype'),
			url('//at.alicdn.com/t/font_1571015_wp63s5c36xe.svg#iconfont') format('svg');
		}
		*/ .iconfont {
			font-family: "iconfont" !important;
			font-size: 16px;
			font-style: normal;
			-webkit-font-smoothing: antialiased;
			-moz-osx-font-smoothing: grayscale;
		}
		.title {
			margin: 5px 0px 0px 0px;
			color: #6d6d72;
			font-size: 12px;
		}
		.star {
			float: right;
			margin-right: 20px;
			width: 20px;
		}
		.summary {
			height: 28px;
			overflow: hidden; //超出的文本隐藏
			text-overflow: ellipsis; //溢出用省略号显示
		}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title"></h1>
			<a class="mui-icon mui-icon-more-filled" href="#popover2" style="color: #000;float: right;" id="menu_folder"></a>
		</header>
		 
		<!--文件夹右上角菜单-->
		<div id="popover2" class="mui-popover">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell" id="batch-click">同步
				</li>
				<li class="mui-table-view-cell check-radio">显示摘要&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<svg t="1576747105360" class="icon right" viewBox="0 0 1433 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2857" width="16" height="16">
						<path d="M42.530133 606.8224C16.315733 579.584 13.380267 532.753067 35.498667 502.647467L33.5872 505.173333a66.696533 66.696533 0 0 1 94.549333-13.5168l226.645334 173.6704c59.869867 45.8752 154.965333 44.373333 213.128533-4.096L1323.690667 31.402667a76.5952 76.5952 0 0 1 101.034666 4.5056L1406.429867 17.749333a67.037867 67.037867 0 0 1 0.136533 95.8464l-846.506667 833.1264a134.621867 134.621867 0 0 1-191.624533-2.730666L42.530133 606.890667z" p-id="2858" fill="#1296db"></path>
					</svg>
				</li>
			</ul>
		</div>
		<!--显示最新的笔记-->
		<div id="newest_note">
		</div>

		<script src="js/jquery-3.4.1.js"></script>
		<script src="js/mui.min.js"></script>
		<script>
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});

			var token = null;
			var labelid = null;
			var myUrl1 = null;

			/*$("#back_folder").click(function(){
				console.log("aaa")
				mui.openWindow('tabbar.html')
				$("#tabbar-with-map").load("personal.html")
			})*/

			mui.plusReady(function() {
				token = plus.storage.getItem('accessToken');
				myUrl1=plus.storage.getItem("myUrl1");
				var self = plus.webview.currentWebview();
				labelid = self.labelid;
				var name = self.name;
				$(".mui-title").text(name);
				console.log(labelid);
				console.log(token);


				mui.ajax(myUrl1+'/note-star/notes/labelNotes?token=' + token, {
					data: {
						labelId: labelid
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型
					timeout: 10000, //超时时间设置为10秒；
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					success: function(d) {
						console.log(d);
						for(var i = 0; i < d.length; i++) {
							$('#newest_note').append('<div class="note-list" onclick="turnPage(\'' + d[i].id + '\')"><span class="title-weight">' + d[i].notesName + '<img src="img/star.png" class="star"/></span><div class="summary"><p class="title">' + d[i].content + '</p></div><p class="title">' + d[i].createTime + '</p><input type="hidden" class="favorite" value="' + d[i].favorite + '"/></div>')
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
						console.log(false);
					}
				});

			});

			//批量选择
			$("#batch-click").click(function() {
				//隐藏弹出框
				mui("#popover2").popover('toggle');
				//显示复选框
				$(".inp-check").show();
				$(".inp-label").css("padding-left", "58px");
				//取消点击跳转事件
				$(".folder-list").attr("onclick", "");
				$(".note-list").attr("onclick", "");
			})

			//点击排序方式
			$(".check-radio").click(function() {
				$(".right").hide();
				$(this).find("svg").show();
			})

			//跳转到查看页面的方法
			function turnPage(d) {
				mui.openWindow({
					url: 'show_note.html',
					//传递的参数
					extras: {
						ids: d,
					}
				})
			}

			//查询所有的加星文件
			//			mui.ajax(myUrl1+'/note-star/notes/labelNotes?token='+token, {
			//				data: {
			//					labelId: labelid
			//				},
			//				dataType: 'json', //服务器返回json格式数据
			//				type: 'post', //HTTP请求类型
			//				timeout: 10000, //超时时间设置为10秒；
			//				headers: {
			//					'Content-Type': 'application/json'
			//				},
			//				success: function(d) {
			//					for(var i = 0; i < d.length; i++) {
			//						$('#newest_note').append('<div class="note-list" onclick="turnPage(\'' + d[i].id + '\')"><span class="title-weight">' + d[i].notesName + '<img src="img/star.png" class="star"/></span><p class="title">摘要</p><p class="title">' + d[i].createTime + '</p><input type="hidden" class="favorite" value="' + d[i].favorite + '"/></div>')
			//					}
			//				},
			//				error:function(xhr,type,errorThrown){
			//					//异常处理；
			//					console.log(type);  
			//				}
			//			});
			//			console.log(labelid);
		</script>
	</body>

</html>